<template>
    <page-container>
        <cu-custom slot="header" :isBack="true" bgColor="bg-white">
            <block slot="content">核销台</block>
        </cu-custom>
        <view class="verification" slot="center">
            <view class="verification-bg">
                <view class="hxjl" @click="torecords">
                    <view class="hxjllogo">
                        <image :src="staticImgUrl + 'hexiao/record.png'" mode=""></image>
                    </view>
                    <view class="hxjltext">核销记录</view>
                </view>

                <view class="process">
                    <view class="lefttext">
                        <view class="lefttextIcon">
                            <image :src="staticImgUrl + 'hexiao/inputlo.png'" mode=""></image>
                        </view>
                        <view class="importtext">输入核销码</view>
                    </view>
                    <view class="isrightl">
                        <image :src="staticImgUrl + 'hexiao/rightl.png'" mode=""></image>
                    </view>
                    <view class="righttext">
                        <view class="righttextIcon">
                            <image :src="staticImgUrl + 'hexiao/search.png'" mode=""></image>
                        </view>
                        <view class="importtext">核销</view>
                    </view>
                </view>

                <view class="inputbox">
                    <view class="input-vl"><input type="text" placeholder="输入核销码" v-model="codenumber" style="height: 100%;text-align: center;" /></view>
                </view>

                <view class="affirm" @click="toplatform">确认</view>
            </view>

            <!-- #ifdef MP-WEIXIN -->
            <view class="scanIcon" @click="shaoMa">
                <image :src="staticImgUrl + 'hexiao/scan.png'" mode=""></image>
            </view>
            <!-- #endif -->
        </view>
    </page-container>
</template>
<script>

export default {
	data() {
		return {
			codenumber: ''
		}
	},
	computed: {},
	components: {},
	async onLoad(e) { },
	mounted() { },
	methods: {
		toplatform() {
			if (this.codenumber == '') {
				this.$Utils.tip('请输入核销码')
				return
			}
			this.$util.redirectTo('/chatPages/verification/platform', {
				codenumber: this.codenumber
			})
			this.codenumber = ''
		},
		torecords() {
			this.$util.redirectTo('/chatPages/verification/records')
		},
		shaoMa() {
			uni.scanCode({
				onlyFromCamera: true,
				success: res => {
					let newarr = res.result.split('?code=')
					if (newarr.length == 2) {
						this.codenumber = newarr[1]
					}
					console.log('条码类型：' + res.scanType)
					console.log('条码内容：' + res.result)
				}
			})
			// this.$Utils.tip('功能待开放，敬请期待');
		}
	},
	onLoad() { }
}
</script>

<style lang="scss" scoped>
image {
    width: 100%;
    height: 100%;
}
.verification {
    width: 100%;
    position: relative;
    .verification-bg {
        width: 750rpx;
        height: 721rpx;
        background-image: url("https://toc.nanyuecloud.com/toc-inst-app/zqanswer/test/img/xmg/hexiao/cancelbg.png");
        background-repeat: no-repeat;
        background-size: 100% 100%;
    }
    .hxjl {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        padding-right: 21rpx;
        padding-top: 21rpx;
        .hxjllogo {
            width: 23rpx;
            height: 27rpx;
        }
        .hxjltext {
            font-size: 28rpx;
            font-family: PingFang SC;
            font-weight: 500;
            color: #fd3b5c;
            padding-left: 23rpx;
        }
    }
    .process {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-around;
        padding-top: 90rpx;
        padding-bottom: 60rpx;
        .lefttext {
            .lefttextIcon {
                width: 80rpx;
                height: 80rpx;
                margin: 0 auto;
            }
        }
        .importtext {
            font-size: 28rpx;
            font-family: PingFang SC;
            font-weight: 500;
            color: #222222;
            text-align: center;
            padding-top: 24rpx;
        }
        .isrightl {
            width: 95rpx;
            height: 20rpx;
        }
        .righttextIcon {
            width: 80rpx;
            height: 80rpx;
            margin: 0 auto;
        }
    }
    .inputbox {
        width: 100%;
        .input-vl {
            padding: 0 30rpx;
            width: 580rpx;
            height: 86rpx;
            border: 1rpx solid #999999;
            border-radius: 12rpx;
            margin: 0 auto;
        }
    }
    /deep/.uni-input-placeholder {
        text-align: center;
    }
    /deep/uni-input {
        height: 86rpx;
        line-height: 86rpx;
        text-align: center;
    }
    .affirm {
        width: 380rpx;
        height: 80rpx;
        background: linear-gradient(90deg, #ff7044, #fd3b5c);
        border-radius: 40rpx;
        margin: 50rpx auto 0 auto;
        font-size: 28rpx;
        font-family: PingFang SC;
        font-weight: 500;
        color: #ffffff;
        text-align: center;
        line-height: 80rpx;
    }
}
.scanIcon {
    width: 160rpx;
    height: 160rpx;
    position: absolute;
    top: 120%;
    left: 50%;
    transform: translate(-50%, -50%);
}
</style>
